Repository navigation
[0.4.x] libvisual + libvisual-plugins: Fix compilation for Debian "bullseye" - #237
Conversation
| dnl Library functions. | ||
| AC_FUNC_MALLOC | ||
| AC_CHECK_FUNCS([floor gettimeofday memmove memset pow sqrt]) | ||
| AC_CHECK_FUNCS([malloc floor gettimeofday memmove memset pow sqrt]) |
There was a problem hiding this comment.
We can get rid of these checks except for gettimeofday(). The rest are part of the C99 standard.
There was a problem hiding this comment.
@kaixiong I have reverted addition of malloc and realloc to these lists just now. When checking the C99 draft linked from https://stackoverflow.com/questions/4883212/html-version-of-c-standard-draft-n1256-pdf there are more of these that I find not mentioned in there. sqrt and pow is libm (or at least can be). I'm not sure what would be the best approach here. I guess our key mission here is to catch later complete errors at configure stage. I can drop some entries but then it should be correct down to the last bit. What do you think?
There was a problem hiding this comment.
PS: @kaixiong I was replying here for the lists in both halves, if that matters. E.g. usleep is one of those not found but it's not up here but in core libvisual.
There was a problem hiding this comment.
@kaixiong I have dropped all names that I could find in the C99 PDF now.
There was a problem hiding this comment.
@hartwork thanks!
As an alternative to combing through the C standard documents, I look at manpages e.g. man strdup . They contain a section named 'Conforming To' that lists down all the standards (C, POSIX, etc.) the function is included in. It also mentions if the function is a compiler-specific extension. Quite a bit more informative than the C standard.
libm is a glibc specific thing, probably separated out to improve link times. It's not even necessary when building C++ programs against libstdc++, libm is indirectly linked. The C/C++ libraries I've seen on other platforms do not do this.
So when we're using glibc and expect C99 conformance, then libm has to include all of mathematics functions from the standard.
There was a problem hiding this comment.
@kaixiong I was using man pages initially, but overlooked their STANDARDS section — good to know! 👍
354778e to
1b42908
Compare
Link errors for examples on Debian bullseye: > [..] > make[2]: Entering directory '[..]/libvisual/examples' > /bin/bash ../libtool --tag=CC --mode=link gcc -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -O1 -pipe -g -fsanitize=address -fno-omit-frame-pointer -g -fsanitize=address -o simplesdl simplesdl.o -lSDL ../libvisual/libvisual-0.4.la -lm -ldl > libtool: link: gcc -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -O1 -pipe -g -fsanitize=address -fno-omit-frame-pointer -g -fsanitize=address -o .libs/simplesdl simplesdl.o -lSDL ../libvisual/.libs/libvisual-0.4.so -lm -ldl -Wl,-rpath -Wl,[..]/INSTALL_PREFIX/lib > /usr/bin/ld: ../libvisual/.libs/libvisual-0.4.so: undefined reference to `rpl_malloc' > /usr/bin/ld: ../libvisual/.libs/libvisual-0.4.so: undefined reference to `rpl_realloc' > collect2: error: ld returned 1 exit status > [..] Compile error for lv-tool on Debian bullseye: > [..] > make[2]: Entering directory '[..]/libvisual/tools/lv-tool' > [..] > In file included from /usr/include/c++/10/stdlib.h:36, > from /usr/include/SDL/SDL_stdinc.h:40, > from /usr/include/SDL/SDL_main.h:26, > from /usr/include/SDL/SDL.h:30, > from lv-tool.cpp:30: > /usr/include/c++/10/cstdlib:151:11: error: ‘malloc’ has not been declared in ‘::’ > 151 | using ::malloc; > | ^~~~~~ > /usr/include/c++/10/cstdlib:164:11: error: ‘realloc’ has not been declared in ‘::’ > 164 | using ::realloc; > | ^~~~~~~ > In file included from /usr/include/SDL/SDL_stdinc.h:40, > from /usr/include/SDL/SDL_main.h:26, > from /usr/include/SDL/SDL.h:30, > from lv-tool.cpp:30: > /usr/include/c++/10/stdlib.h:65:12: error: ‘malloc’ has not been declared in ‘std’ > 65 | using std::malloc; > | ^~~~~~ > /usr/include/c++/10/stdlib.h:73:12: error: ‘realloc’ has not been declared in ‘std’ > 73 | using std::realloc; > | ^~~~~~~ > [..]
1b42908 to
361bfb0
Compare
Compile error on Debian bullseye: > [..] > make[4]: Entering directory '[..]/plugins/actor/corona' > /bin/bash ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I[..]/include/libvisual-0.4 -O1 -pipe -g -fsanitize=address -fno-omit-frame-pointer -DUNIX_X -D_REENTRANT -MT actor_corona.lo -MD -MP -MF .deps/actor_corona.Tpo -c -o actor_corona.lo actor_corona.cpp > libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I[..]/include/libvisual-0.4 -O1 -pipe -g -fsanitize=address -fno-omit-frame-pointer -DUNIX_X -D_REENTRANT -MT actor_corona.lo -MD -MP -MF .deps/actor_corona.Tpo -c actor_corona.cpp -fPIC -DPIC -o .libs/actor_corona.o > In file included from /usr/include/c++/10/stdlib.h:36, > from actor_corona.cpp:29: > /usr/include/c++/10/cstdlib:151:11: error: ‘malloc’ has not been declared in ‘::’ > 151 | using ::malloc; > | ^~~~~~ > In file included from actor_corona.cpp:29: > /usr/include/c++/10/stdlib.h:65:12: error: ‘malloc’ has not been declared in ‘std’ > 65 | using std::malloc; > | ^~~~~~ > [..]
361bfb0 to
d4eda88
Compare
CC @eribertomota